package com.reflect.demo;

import java.util.ArrayList;

import org.omg.CORBA.IntHolder;

public class Student extends Persion {

	public Student(String name) {
		super(name);
		
	}
	
	public Student(){
		super("С��");
	}
	
	public void display(){
		System.out.println(this.getClass());
	}
	
	public void display2(){
		System.out.println(".................");
	}
	
	public boolean equals(Object obj){
		boolean flag = false;
		
		//��αȲ������
//		if(!super.equals(obj)){ 
//			flag =  false;
//		}
		if(this.age == ((Persion)obj).age)
			flag = true;
		return flag;
		
	}
	
	public static void intHolder(IntHolder x){
		x.value = x.value + 1;
	}
	
	public static void dis(){
		
	}
	
	
	
	public static void main(String[] args){
		Persion[] p = new Persion[3];
		p[0] = new Student("СС");
		
		Student s = new Student();
		Student s1 = new Student();
		
		System.out.println(p[0].getName());
		System.out.println(s.getName());
		System.out.println(s.age);
		
		System.out.println(s.getClass());
		System.out.println(p[0].getClass().getSuperclass().getName());
		s.display();
		
		//System.out.println(s.equals(p[0]));
		
		//System.out.println(s.equals(s1));
		
		System.out.println(p[0] instanceof Persion);
		
		System.out.println(s.toString());
		
		int inta = 5;
		int[] arr = new int[inta];
		
		System.out.println(arr.length);
		
		ArrayList arrayList = new ArrayList(100);
		//System.out.println(arrayList.size());
		//arrayList.set(1, p[0]); //error
		
		//arrayList.ensureCapacity(1000);
		
		arrayList.add(s);
		arrayList.add(s1);
		
		
		Student[] student = new Student[arrayList.size()];
		//Object[] arrObj = arrStudent;
		
		Object[] arrObj = arrayList.toArray();
		
		System.out.println(arrObj.getClass().getSuperclass());
		
		//Persion p2 = new Persion();
		
		
		 //student  = (Student[]) arrayList.toArray();
		
//		arrStudent = (Student[]) arrayList.toArray();
//		
//		System.out.println(((Student)arrObj[0]).getName());
//		
		((Student)p[0]).display2();
		
//		Integer it = 3;
//		System.out.println(it++);
		
		IntHolder x = new IntHolder(1);
		
		Student.intHolder(x);
		
		System.out.println(x.value);
		
		
		
//	try{
//	
//		InetAddress address = InetAddress.getByName(args[0]);
//		
//		System.out.println(args[0]+": "+address.getHostAddress());
//	
//	}catch(UnknownHostException uhe){
//	
//		System.err.println("Unable to find: "+args[0]);
//	
//	}
	
				
		
		
		
		
		
	}

}
